Home:ALL Converter>Hibernate query to Get one hour back rows from oracle table

Hibernate query to Get one hour back rows from oracle table

Ask Time:2018-02-21T11:24:21         Author:user3780032

Json Formatter

I am trying to get the rows created/modified one hour back by using the following SQL query for oracle database

select * from filecontent where row_mod_dt <= sysdate-1/24 order by row_mod_dt desc;

I am trying to implement the same in our java application by using the following hibernate named query

@NamedQuery(name="FileContent.findsent",query="select id from filecontent c where c.rowmoddt <= current_date - 1/24")

But it is not giving the expected data.

Please help me with this.

Thanks,

Author:user3780032,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/48897709/hibernate-query-to-get-one-hour-back-rows-from-oracle-table
osama yaccoub :

you must use the identification variable c to refer to entity attributes ... and the entity name in the from not the table: \nquery=\"select c from YourEntityName c where c.rowmoddt <= current_date - 1/24 orderby c.rowmoddt desc\"",
2018-02-21T11:28:11
yy